<?php
/* @var $this ApayController */
/* @var $model Apay */
/* @var $form CActiveForm */
?>

<div class="form">

    <?php
    $form = $this->beginWidget('CActiveForm', array(
        'id' => 'apay-_pay-form',
        // Please note: When you enable ajax validation, make sure the corresponding
        // controller action is handling ajax validation correctly.
        // See class documentation of CActiveForm for details on this,
        // you need to use the performAjaxValidation()-method described there.
        'enableAjaxValidation' => false,
    ));
    ?>



    <?php echo $form->errorSummary($model); ?>



    <div class="clear"></div>
    <div class="form_left">
        <?php echo $form->labelEx($model, 'OrderNo'); ?>
    </div>
    <div class="form_right">
        <?php
        $category_ = Config::model()->findAll('flag=1');
        $list = CHtml::listData($category_, 'id', 'name');
         if(isset($_GET['k'])){
            $idd = $_GET['k'];
            echo $form->dropDownList($model, 'OrderNo', $list, array('options' => array($idd => array('selected' => true)),
            //'onchange' => 'document.location.href = "' . Yii::app()->request->baseUrl . '/mua-quang-cao-loai/" + this.value',
            'ajax' => array(
                'type' => 'POST', //request type
                'url' => CController::createUrl('manager/dynamicvalue'), //url to call.
                'update' => '#qcso', //selector to update
                'data' => array('id' => 'js:this.value'),
        )));
        }  else {
        echo $form->dropDownList($model, 'OrderNo', $list, array('prompt' => '----- Chọn loại quảng cáo -----',
            //'onchange' => 'document.location.href = "' . Yii::app()->request->baseUrl . '/mua-quang-cao-loai/" + this.value',
            'ajax' => array(
                'type' => 'POST', //request type
                'url' => CController::createUrl('manager/dynamicvalue'), //url to call.
                'update' => '#qcso', //selector to update
                'data' => array('id' => 'js:this.value'),
        )));}
        ?>
        <?php echo $form->error($model, 'OrderNo'); ?>
    </div>

    <div class="clear"></div>
    <div class="form_left">
        <?php echo $form->labelEx($model, 'OrderCashAmount'); ?>
    </div>
    <div class="form_right">
        <div id="qcso">
            
            <?php
            $session = new CHttpSession;
            $session->open();
            if (isset($session['trapos'])) {
                if ($session['trapos'] == '1') {
                    ?>
                    <input id="qcso" width="100" maxlength="100" readonly="1" type="text" value="<?php echo $session['loaiqc'];?>" name="Text">
            <?php
                }
                unset($session['trapos']);
            }  else {?>
                <input id="qcso" width="100" maxlength="100" readonly="1" type="text" value="0" name="Text">
                <?php
}
            ?>
        </div>

     
    </div>

    <div class="clear"></div>
    <div class="form_left">
        Thời gian
    </div>
    <div class="form_right">
        <?php
        echo CHtml::dropDownList('thoigian', '', array('1' => '1 tháng', '2' => '2 tháng', '3' => '3 tháng', '4' => '4 tháng', '5' => '5 tháng', '6' => '6 tháng', '7' => '7 tháng', '8' => '8 tháng', '9' => '9 tháng', '10' => '10 tháng', '11' => '11 tháng', '12' => '1 năm', '24' => '2 năm')
                , array(
            'ajax' => array(
                'type' => 'POST', //request type
                'url' => CController::createUrl('manager/dynamicvalue1'), //url to call.
                'update' => '#qcso', //selector to update
                'data' => array('id' => 'js:this.value'),
        )));
        ?>

    </div>


    <div class="clear"></div>
    <div class="form_left">.</div>
    <div class="row buttons">
        
        <?php echo CHtml::submitButton('Mua ngay'); ?>
    </div>

    <?php
    if(isset($session['loaiqc1'])){
        echo $session['loaiqc1'];
    }
    $this->endWidget(); ?>

</div><!-- form -->
